Added screenshot_root_directory#443
Conversation
There was a problem hiding this comment.
RobotNotRunningErrordoesn't seem to be imported.- Why not just return
.instead ofos.getcwd? In most cases the end result is the same. - I was thinking
screenshot_root_directorywould be returned only if Robot isn't running, but always returning it if defined may be a useful feature in general.
There was a problem hiding this comment.
- Whoops, nice catch. I haven't written a test for this yet, but I certainly will before its merged in.
- Simply because I like to be explicit.
- If we're going to add it, we may as well make it available to everyone. I actually added it as an argument into the S2L constructor so it'd be a newly documented feature.
|
@pekkaklarck, do you have any advice on testing this feature? Is there a way to "unload" a library? |
|
Would |
|
Oooops, sorry for accidentally closing this. Having close and comment buttons next to each others is super annoying. |
|
I don't think so... I may just create a keyword to change the screenshot directory from within the test... Though that could lead to issues I suppose... Hmmm.. I'll think on it. |
|
You should actually be able to import the library with different arguments. You just need to use the Having a keyword to change the screenshot directory might still be a good idea, though. |
There was a problem hiding this comment.
It's likely that this could cause an issue. If the same scope sets two screenshot paths then only the first would be popped off when the scope exited. That could cause an issue where the wrong path is used for other scopes...
EDIT: I've decided to go ahead and use what I've got. Being that this is a private part of the API I can solidify this in the next release.
Added screenshot_root_directory argument and set_screenshot_directory keyword
This enhancement is to better support PageObjects as discussed here.
These changes are not necessarily final and reviews are welcome.
This PR would essentially provides a new argument for S2L called
screenshot_root_directorywhich can be provided to set the default root directory that screenshots will be stored in. Subdirectories should still be managed by the relevant keywords.By default the
screenshot_root_directoryargument is set toNoneand will use RF's log directory as the root directory for screenshots. If one is trying to run a screenshot keyword while RF isn't running and fails to providescreenshot_root_directorythen the current working directory will be used instead.Pre-merge checklist
RobotNotRunningErrorscreenshot_root_directory